package com.apes.hr.base.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.plugin.fileserver.File;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 人员特殊信息记录
 *
 * @author wuq
 * @create 2018-08-22 11:43
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = SpecialInfo.CONST_TABLE_NAME)
public class SpecialInfo extends Model {

    public static final String CONST_TABLE_NAME = "hr_special_info";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "人员特殊信息记录")
    private String id;   // 编码

    @Column(name = "note", length = 4000)
    private String note; // 信息记录

    @File
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "info_photo", columnDefinition = "CLOB")
    private String infoPhoto;   // 图片

    @File
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "info_file", columnDefinition = "CLOB")
    private String infoFile; // 复件信息

    @Column(name = "valid", nullable = false, columnDefinition = "number(1,0) default 1")
    private boolean valid = true; //有效

}